package main

import (
    "fmt"
    "math"
)

type Shape interface {
    Area() float64
    Perimeter() float64
}

type Rect struct {
    width float64
    height float64
}

type Circle struct {
    radius float64
}

func (r Rect) Area() float64 {
    return r.width * r.height
}

func (r Rect) Perimeter() float64 {
    return 2 * (r.width + r.height)
}

func (c Circle) Area() float64 {
    return math.Pi * c.radius * c.radius
}

func (c Circle) Perimeter() float64 {
    return math.Pi * c.radius * 2
}

func main(){
//     var s Shape = Rect{10, 20}
    var s *Rect = new(Rect)
    (*s).width = 10
    (*s).height = 10
    fmt.Printf("type of s is %T \n", s)
    fmt.Printf("value of s is %v \n", s)
    fmt.Printf("value of s is %0.2f \n", s.Area())
}
